﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Traceability.App.Application;
using Traceability.App.Application.Dto.Input;
using Traceability.App.Domain.Model;
using Traceability.App.ErrorCode;

namespace Traceability.App.Api.Controllers
{
    /// <summary>
    /// 屠宰控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SlaughteController : ControllerBase
    {
        private readonly IService service;
        public SlaughteController(IService service)
        {
            this.service = service;
        }
        /// <summary>
        /// 添加/修改屠宰信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public ApiResult<int> AddSlaughte(SlaughteInput input) 
        {
            return service.AddSlaughte(input);
        }

        /// <summary>
        /// 获取屠宰信息
        /// </summary>
        /// <param name="batch"></param>
        /// <returns></returns>
        [HttpGet]
        public ApiResult<List<SlaughterModel>> GetSlaughteShow(string batch) 
        {
            return service.GetSlaughteShow(batch);
        }

        /// <summary>
        /// 添加/修改屠宰企业信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public ApiResult<int> AddSlaughterTable(Slaughter_TableInput input) 
        {
            return service.AddSlaughterTable(input);
        }

        /// <summary>
        /// 获取屠宰企业信息
        /// </summary>
        /// <param name="batch"></param>
        /// <returns></returns>
        [HttpGet]
        public ApiResult<List<Slaughter_TableModel>> GetSlaughterTableShow(string batch) 
        {
            return service.GetSlaughterTableShow(batch);
        }
    }
}
